import Loading from "./Loading.vue";
import Vue from "vue";

//获取Loading组件的构造函数,构造Loading组件
const LoadingConstructor = Vue.extend(Loading);

const serve = () => {
  //创建一个Loading的实例
  let loadingInstance = new LoadingConstructor();
  //将组件挂载到指定的元素
  loadingInstance.$mount(document.createElement("div"));
  //将组件挂载的元素添加带body下
  document.body.appendChild(loadingInstance.$el);
  Vue.nextTick(() => {
    loadingInstance.visible = true;
  });
  return loadingInstance;
};
export default serve;
